{template head}

<body>
<script type="text/javascript">
var ajaxparam = {
		'url' : '{CONTROL_URL}?a={$action}'
};

function submitcheck()
{
	return true;
}

function saveinfo()
{
	if(!submitcheck())
	{
		return;
	}
	var url = '{SITE_URL}ajax/index.php?m=saveRole';
	
	var data = $('#savedata').serialize();
		
	var callback = function(data)
	{
		if(data.sign == -2)
		{
			window.location = data.url;
		}
		else
		{
			if(data.sign == 1)
			{
				//添加成功,返回列表页
				layer.alert(data.msg,function(){
					window.location = $('#gotoList').attr('href');
				});
			}
			else
			{
				if(data.msg)
				{
					layer.msg(data.msg);
				}
				else
				{
					layer.msg('操作失败');
				}
			}
		}
	};
	makeAjax('post',url,data,callback);
}


</script>
<div class="wrapper">
	<div class="crumbs"><span style="margin: 0 5px;color: #333;font-size: 14px;">{$fTitle}</span> &gt; <a id="gotoList" href="{SITE_URL}index.php?a=roleM">{$sTitle}</a> &gt; <span>{$tTitle}<a style="float:right;font-size:13px;" href="javascript:history.go(-1);">返回</a></span></span>

	<div class="container_tit clearfix mb20 ft14">
		
	<form id="savedata">
		<input type="hidden" name="id" value="{$role[id]}" />
		<h2 class="form_tit">角色信息  </h2>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">角色名称：</label>
				<input type="text" id="name" name="name" value="{$role[name]}" class="text w200" />
			</p>
		</div>
		
		{loop $list $k $v}
		<div class="form_item clearfix">
			<p class="clearfix">
				<label class="name">{$v[name]}：</label>
			</p>
			<p class="clearfix">
				{loop $v['list'] $k1 $v1}
				{php $sonlist=$role[permission][$k][$k1]}
				<table class="table clearfix" style="margin-left: 155px;">
			        <tr>
			        	<td style="width: 100px;">
			        		{$v1[name]}
			        	</td>
			        	<td>
			        		<ul>
			        		{loop $v1['permission'] $k2 $v2}
			        			<li style="float:left;padding-right:10px ;">
			        			{if in_array($k2,$sonlist)}
			        				<input style="vertical-align: middle;" class="checkbox" type="checkbox" checked name="permission[$k][$k1][]" value="{$k2}" /><label for="resort_index">{$v2}</label>
			        			{else}
			        				<input style="vertical-align: middle;" class="checkbox" type="checkbox" name="permission[$k][$k1][]" value="{$k2}" /><label for="resort_index">{$v2}</label>
			        			{/if}
			        			</li>
			        		{/loop}
			        		</ul>
			        	</td>
			        </tr> 
			    </table>
				{/loop}
			</p>
        </div>
        {/loop}
        
        <div class="form_item clearfix">
			<p class="clearfix" style="height: 28px;line-height: 28px;">
				<label class="name">是否启用：</label>
				<input style="vertical-align: middle;" {if $role['status'] == '1' || empty($chanpin['cp_status'])}checked{/if} class="checkbox" type="radio" name="status" value="1" />
				<label for="resort_index" class="mr15">禁用</label>
				<input style="vertical-align: middle;" {if $role['status'] == '2'}checked{/if} class="checkbox" type="radio" name="status" value="2" />
				<label for="resort_index">启用</label>
			</p>
		</div>
        <div class="form_item clearfix">
			<p class="clearfix">
				<label class="name"></label>
			    <input type="button" class="btnblue" value="提交" onclick="saveinfo()" />
			</p>
		</div>
    </form>
    </div>
</div>
</body>
{template foot}
